package pl.wroc.uni.ii.evolution.sampleimplementation.comparision;

import pl.wroc.uni.ii.evolution.engine.EvAlgorithm;
import pl.wroc.uni.ii.evolution.engine.individuals.EvBinaryVectorIndividual;
import pl.wroc.uni.ii.evolution.engine.operators.general.display.EvRealtimeToPrintStreamStatistics;
import pl.wroc.uni.ii.evolution.engine.prototype.EvTask;
import pl.wroc.uni.ii.evolution.engine.samplealgorithms.EvECGA;
import pl.wroc.uni.ii.evolution.engine.terminationconditions.EvMaxIteration;
import pl.wroc.uni.ii.evolution.objectivefunctions.EvKDeceptiveOneMax;
import pl.wroc.uni.ii.evolution.solutionspaces.EvBinaryVectorSpace;

public class EvECGAComparision {
  public static void main(String[] args) {
    
    EvKDeceptiveOneMax objective_function = new EvKDeceptiveOneMax(4);
    
    EvAlgorithm<EvBinaryVectorIndividual> ecga = new EvECGA(false, 4000, 16 , 1);
      
    ecga.setSolutionSpace(new EvBinaryVectorSpace(objective_function, 60));
    ecga.setObjectiveFunction(objective_function);
    ecga.setTerminationCondition(new EvMaxIteration<EvBinaryVectorIndividual>(7));
    EvTask evolutionary_task = new EvTask();
    evolutionary_task.setAlgorithm(ecga);
    ecga.addOperator(new EvRealtimeToPrintStreamStatistics<EvBinaryVectorIndividual>(System.out));
    long cur_time = System.currentTimeMillis();
    evolutionary_task.run();
    long after_time = System.currentTimeMillis();
    System.out.println("RUN TIME: " + (after_time - cur_time) + " msec");
  }
}
